<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body class="z1">
    <p>p1</p>
    <p class="p1">p2</p>
    <p class="p1">p3</p>
    <a href="" name="a1">a1</a>
    <a href="" name="a1">a2</a>
    <a href="" name="a1">a3</a>
    <script>
      const ps = document.querySelectorAll("p");//不是实时，界面变化变量内的元素不会发生变化
      const as = document.getElementsByName("a1");//是实时的，界面变化变量内的元素会一起变化
    </script>
  </body>
</html>
